<html>
<head><meta charset="utf-8"><title>program-clauses callback · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html">program-clauses callback</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="135423216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423216">(Oct 08 2018 at 19:28)</a>:</h4>
<p><span class="user-mention" data-user-id="131694">@scalexm</span> ok, carry on :)</p>



<a name="135423223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423223">(Oct 08 2018 at 19:28)</a>:</h4>
<p>if I try to call <code>self.infcx.tcx.program_clauses_for_env(*environment);</code> I get a compile error: "argument requires that <code>'tcx</code> must outlive <code>'gcx</code>"</p>



<a name="135423227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423227">(Oct 08 2018 at 19:28)</a>:</h4>
<p>I don't understand why</p>



<a name="135423235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423235">(Oct 08 2018 at 19:29)</a>:</h4>
<p>can I see the diff maybe?</p>



<a name="135423251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423251">(Oct 08 2018 at 19:29)</a>:</h4>
<p>I'm guessing though it's because <code>program_clause_for_env</code> is a query, and hence the environment must be a <code>ty::ParamEnv&lt;'gcx&gt;</code>?</p>



<a name="135423254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423254">(Oct 08 2018 at 19:29)</a>:</h4>
<p>in effect</p>



<a name="135423262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423262">(Oct 08 2018 at 19:29)</a>:</h4>
<p>(is it a query?)</p>



<a name="135423315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423315">(Oct 08 2018 at 19:30)</a>:</h4>
<p>in any case the signature is:</p>
<div class="codehilite"><pre><span></span><span class="k">crate</span><span class="w"> </span><span class="k">fn</span> <span class="nf">program_clauses_for_env</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="n">tcx</span>: <span class="nc">TyCtxt</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;tcx</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">param_env</span>: <span class="nc">ty</span>::<span class="n">ParamEnv</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Clauses</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
</pre></div>



<a name="135423322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423322">(Oct 08 2018 at 19:30)</a>:</h4>
<p>in particular <code>TyCtxt&lt;'a, 'tcx, 'tcx&gt;</code> seems like it would cause this problem</p>



<a name="135423331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423331">(Oct 08 2018 at 19:30)</a>:</h4>
<p>(to start, we might even just forego having it be a query)</p>



<a name="135423333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423333">(Oct 08 2018 at 19:30)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/compare/master...scalexm:program-clauses" target="_blank" title="https://github.com/rust-lang/rust/compare/master...scalexm:program-clauses">https://github.com/rust-lang/rust/compare/master...scalexm:program-clauses</a></p>



<a name="135423366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423366">(Oct 08 2018 at 19:31)</a>:</h4>
<p>yeah, ok, so that is the problem</p>



<a name="135423371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423371">(Oct 08 2018 at 19:31)</a>:</h4>
<p>usually what we do is to canonicalize the query key</p>



<a name="135423374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423374">(Oct 08 2018 at 19:31)</a>:</h4>
<p>why the argument should be <code>ty::ParamEnv&lt;'gcx&gt;</code>?</p>



<a name="135423376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423376">(Oct 08 2018 at 19:32)</a>:</h4>
<p>well, it's a bit confusing because of our convention</p>



<a name="135423424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423424">(Oct 08 2018 at 19:32)</a>:</h4>
<p>that is, in the signature above, there is no <code>'gcx</code></p>



<a name="135423426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423426">(Oct 08 2018 at 19:32)</a>:</h4>
<p>so in that case <code>'tcx</code> refers to the global arena</p>



<a name="135423427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423427">(Oct 08 2018 at 19:32)</a>:</h4>
<p>ok</p>



<a name="135423430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423430">(Oct 08 2018 at 19:32)</a>:</h4>
<p>in particular you see <code>TyCtxt&lt;'_, 'tcx, 'tcx&gt;</code></p>



<a name="135423432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423432">(Oct 08 2018 at 19:32)</a>:</h4>
<p>the second argument is the 'global lifetime'</p>



<a name="135423437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423437">(Oct 08 2018 at 19:32)</a>:</h4>
<p>by setting both the same, we force <code>'tcx</code> to be the global lifetime</p>



<a name="135423444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423444">(Oct 08 2018 at 19:32)</a>:</h4>
<p>if it were <code>TyCtxt&lt;'_, '_, 'tcx&gt;</code> that would not be the case</p>



<a name="135423446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423446">(Oct 08 2018 at 19:33)</a>:</h4>
<p>but queries only operate on global data</p>



<a name="135423460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423460">(Oct 08 2018 at 19:33)</a>:</h4>
<p>ah yeah ok</p>



<a name="135423462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423462">(Oct 08 2018 at 19:33)</a>:</h4>
<p>since the caches don't want to be tied to some particular inference step</p>



<a name="135423464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423464">(Oct 08 2018 at 19:33)</a>:</h4>
<p>right</p>



<a name="135423470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423470">(Oct 08 2018 at 19:33)</a>:</h4>
<p>indeed a <code>TyCtxt&lt;'_, 'gcx, 'gcx&gt;</code> naming convention would be less confusing I guess :)</p>



<a name="135423471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423471">(Oct 08 2018 at 19:33)</a>:</h4>
<p>anyway we could just make it not a query for now, or we can canonicalize the key — we could even just "lift" the key for now</p>



<a name="135423474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423474">(Oct 08 2018 at 19:33)</a>:</h4>
<blockquote>
<p>indeed a <code>TyCtxt&lt;'_, 'gcx, 'gcx&gt;</code> naming convention would be less confusing I guess :)</p>
</blockquote>
<p>yes</p>



<a name="135423518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423518">(Oct 08 2018 at 19:34)</a>:</h4>
<p>in practice, the param env <strong>at present</strong> is always going to be global</p>



<a name="135423523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423523">(Oct 08 2018 at 19:34)</a>:</h4>
<p>that won't always be true</p>



<a name="135423528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423528">(Oct 08 2018 at 19:34)</a>:</h4>
<p>once we want to support implication goals</p>



<a name="135423531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423531">(Oct 08 2018 at 19:34)</a>:</h4>
<p>ok so just lift should work for now</p>



<a name="135423543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423543">(Oct 08 2018 at 19:34)</a>:</h4>
<p>but yeah for now we could do <code>self.tcx.lift_to_global(param_env).unwrap()</code></p>



<a name="135423549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423549">(Oct 08 2018 at 19:34)</a>:</h4>
<p>and once we get to implication goals, we'll notice :)</p>



<a name="135423556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423556">(Oct 08 2018 at 19:34)</a>:</h4>
<p>ok, so second problem comes with the contents of <code>ParamEnv</code></p>



<a name="135423579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423579">(Oct 08 2018 at 19:35)</a>:</h4>
<p>if we'd like to have implied bounds from types, it should somehow include the input types</p>



<a name="135423582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423582">(Oct 08 2018 at 19:35)</a>:</h4>
<p>(canonicalizing would possibly be better, of course, since it would equate various regions)</p>



<a name="135423594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423594">(Oct 08 2018 at 19:35)</a>:</h4>
<p>right so it needs something like <code>WellFormed(T)</code>?</p>



<a name="135423600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423600">(Oct 08 2018 at 19:35)</a>:</h4>
<p>yes, so currently <code>ParamEnv</code> carries the "rustc-style" predicates</p>



<a name="135423643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423643">(Oct 08 2018 at 19:36)</a>:</h4>
<p>(oh, that reminds me that we were going to talk about <a href="https://github.com/rust-lang-nursery/chalk/pull/176" target="_blank" title="https://github.com/rust-lang-nursery/chalk/pull/176">chalk#176</a>)</p>



<a name="135423646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423646">(Oct 08 2018 at 19:36)</a>:</h4>
<p>e.g. <code>ty::TraitPredicate</code> etc</p>



<a name="135423668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423668">(Oct 08 2018 at 19:36)</a>:</h4>
<p>right right</p>



<a name="135423677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423677">(Oct 08 2018 at 19:36)</a>:</h4>
<p>I mean we have a WellFormed predicate but</p>



<a name="135423686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423686">(Oct 08 2018 at 19:37)</a>:</h4>
<p>it may or may not make sense to try and "split" into a new-style predicate, I guess?</p>



<a name="135423690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423690">(Oct 08 2018 at 19:37)</a>:</h4>
<p>is that what you are thinking?</p>



<a name="135423699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423699">(Oct 08 2018 at 19:37)</a>:</h4>
<p>yes</p>



<a name="135423711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423711">(Oct 08 2018 at 19:37)</a>:</h4>
<p>basically make <code>DomainGoal</code> and <code>Goal</code></p>



<a name="135423714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423714">(Oct 08 2018 at 19:37)</a>:</h4>
<p>in rustc</p>



<a name="135423766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423766">(Oct 08 2018 at 19:38)</a>:</h4>
<p>instead of re-using <code>ty::Predicate</code> as <code>DomainGoal</code> (is that what we do now?)</p>



<a name="135423770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423770">(Oct 08 2018 at 19:38)</a>:</h4>
<p>we already have <code>Goal</code> obviously</p>



<a name="135423793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423793">(Oct 08 2018 at 19:38)</a>:</h4>
<p>well the only thing I need right now is for <code>program_clauses_for_env</code> to compute the correct set of rules coming from the environment</p>



<a name="135423798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423798">(Oct 08 2018 at 19:38)</a>:</h4>
<p>so currently <code>program_clauses_for_env</code> just uses def ids it finds in the rustc-style predicates</p>



<a name="135423830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423830">(Oct 08 2018 at 19:39)</a>:</h4>
<p>hmm</p>



<a name="135423833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423833">(Oct 08 2018 at 19:39)</a>:</h4>
<p>maybe we should modify the input to that</p>



<a name="135423893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423893">(Oct 08 2018 at 19:40)</a>:</h4>
<p>well anyway neither here nor there</p>



<a name="135423898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423898">(Oct 08 2018 at 19:40)</a>:</h4>
<p>(e.g., to be a <code>BTreeSet&lt;DefId&gt;</code> or something)</p>



<a name="135423908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423908">(Oct 08 2018 at 19:40)</a>:</h4>
<p>seems like an ungreat idea</p>



<a name="135423917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423917">(Oct 08 2018 at 19:40)</a>:</h4>
<blockquote>
<p>well the only thing I need right now is for <code>program_clauses_for_env</code> to compute the correct set of rules coming from the environment</p>
</blockquote>
<p>are you saying the WF question can wait?</p>



<a name="135423957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423957">(Oct 08 2018 at 19:41)</a>:</h4>
<p>not exactly, I was just thinking that indeed we could add <code>ty::WellFormed(T)</code> to the <code>ParamEnv</code> and then <code>program_clauses_for_env</code> would find the correct def ids from that =)</p>



<a name="135423960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135423960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135423960">(Oct 08 2018 at 19:41)</a>:</h4>
<p>but definitely not the cleanest way :p</p>



<a name="135424026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424026">(Oct 08 2018 at 19:42)</a>:</h4>
<p>maybe I was confused</p>



<a name="135424029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424029">(Oct 08 2018 at 19:42)</a>:</h4>
<p>what def-ids does it need to find</p>



<a name="135424035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424035">(Oct 08 2018 at 19:43)</a>:</h4>
<p>ah, I guess you mean it would find the def-ids of the types</p>



<a name="135424041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424041">(Oct 08 2018 at 19:43)</a>:</h4>
<p>yes sorry</p>



<a name="135424044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424044">(Oct 08 2018 at 19:43)</a>:</h4>
<p>and we would use some query or other to get the WF reverse rules there?</p>



<a name="135424051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424051">(Oct 08 2018 at 19:43)</a>:</h4>
<p>yes we basically just call <code>program_clauses_for(def_id)</code></p>



<a name="135424058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424058">(Oct 08 2018 at 19:43)</a>:</h4>
<p>I see</p>



<a name="135424060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424060">(Oct 08 2018 at 19:43)</a>:</h4>
<p>so if <code>def_id</code> refers to a type, we get the wanted implied bounds</p>



<a name="135424063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424063">(Oct 08 2018 at 19:43)</a>:</h4>
<p>well that <em>does</em> make sense</p>



<a name="135424105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424105">(Oct 08 2018 at 19:44)</a>:</h4>
<p>I'm a bit nervous about adding new things into the param env</p>



<a name="135424114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424114">(Oct 08 2018 at 19:44)</a>:</h4>
<p>I guess we could gate it in on <code>-Zchalk</code> or something</p>



<a name="135424118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424118">(Oct 08 2018 at 19:44)</a>:</h4>
<p>I'm not really sure what would go wrong, tbh</p>



<a name="135424121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424121">(Oct 08 2018 at 19:44)</a>:</h4>
<p>yeah probably</p>



<a name="135424129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424129">(Oct 08 2018 at 19:44)</a>:</h4>
<p>that won't work across crates</p>



<a name="135424281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424281">(Oct 08 2018 at 19:48)</a>:</h4>
<p>maybe we could, for now, use a new <code>ParamEnv</code> type</p>



<a name="135424325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424325">(Oct 08 2018 at 19:48)</a>:</h4>
<p>we could</p>



<a name="135424334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424334">(Oct 08 2018 at 19:48)</a>:</h4>
<p>it would sort of go along with moving away from <code>Predicate</code></p>



<a name="135424338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424338">(Oct 08 2018 at 19:48)</a>:</h4>
<p>basically build up a "parallel" system</p>



<a name="135424342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424342">(Oct 08 2018 at 19:48)</a>:</h4>
<p>yes</p>



<a name="135424346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424346">(Oct 08 2018 at 19:49)</a>:</h4>
<p><code>Predicate</code> isn't a great fit, seeing as it has binders at each step etc</p>



<a name="135424366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424366">(Oct 08 2018 at 19:49)</a>:</h4>
<p>we'd have to encode this stuff in metadata, or else just recompute them on the fly from other metadata things</p>



<a name="135424372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424372">(Oct 08 2018 at 19:49)</a>:</h4>
<p>yes and I don't think that we can easily replace it with the binders at the root instead of at the leafs</p>



<a name="135424390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424390">(Oct 08 2018 at 19:49)</a>:</h4>
<p>but encoding in metadata isn't <em>that</em> hard</p>



<a name="135424508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424508">(Oct 08 2018 at 19:51)</a>:</h4>
<p>also actually the <code>program_clauses</code> callback is quite simple after all</p>



<a name="135424552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424552">(Oct 08 2018 at 19:52)</a>:</h4>
<p>even the naive version I wrote seems good already, the worst thing it does is running over all impls for a given trait</p>



<a name="135424563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135424563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135424563">(Oct 08 2018 at 19:52)</a>:</h4>
<p>seems good</p>



<a name="135425058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135425058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135425058">(Oct 08 2018 at 20:03)</a>:</h4>
<p>ok then I think I'll be tackling the new ParamEnv thing to start with</p>



<a name="135425322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135425322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135425322">(Oct 08 2018 at 20:08)</a>:</h4>
<p>while we're at it, I see that there is a <code>add_clauses</code> callback which should add clauses to the environment</p>



<a name="135425330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135425330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135425330">(Oct 08 2018 at 20:08)</a>:</h4>
<p>so I guess this new ParamEnv should have some form of mutability</p>



<a name="135425332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135425332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135425332">(Oct 08 2018 at 20:08)</a>:</h4>
<p>(in contrast with the existing one)</p>



<a name="135425371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135425371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135425371">(Oct 08 2018 at 20:09)</a>:</h4>
<p>well</p>



<a name="135425425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135425425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135425425">(Oct 08 2018 at 20:10)</a>:</h4>
<p>that is used for the <code>A =&gt; B</code> goals</p>



<a name="135425438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135425438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135425438">(Oct 08 2018 at 20:10)</a>:</h4>
<p>we could make it "in place" mutable potentially</p>



<a name="135425450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135425450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135425450">(Oct 08 2018 at 20:10)</a>:</h4>
<p>we could also just "re-intern" the new set</p>



<a name="135468670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135468670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135468670">(Oct 09 2018 at 13:19)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I'm wondering whether we might need a more fine-grained way of retrieving the clauses for something</p>



<a name="135468678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135468678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135468678">(Oct 09 2018 at 13:19)</a>:</h4>
<p>currently the only thing we have is <code>program_clauses_for(def_id)</code></p>



<a name="135468691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135468691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135468691">(Oct 09 2018 at 13:20)</a>:</h4>
<p>but for example, in <code>program_clauses_for_env</code>, the only clauses we care about are those of the form <code>... :- FromEnv(...)</code></p>



<a name="135468769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135468769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135468769">(Oct 09 2018 at 13:20)</a>:</h4>
<p>conversely if I want to prove for example <code>WellFormed(Self: Trait)</code>, I don't care about all the clauses of the form <code>... :- FromEnv(...)</code></p>



<a name="135468961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135468961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135468961">(Oct 09 2018 at 13:23)</a>:</h4>
<p>basically I'm currently changing chalk integration to using a new type <code>Environment&lt;'tcx&gt;</code> instead of <code>ParamEnv&lt;'tcx&gt;</code>, which just consists in a list of <code>Clause&lt;'tcx&gt;</code></p>



<a name="135469042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135469042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135469042">(Oct 09 2018 at 13:24)</a>:</h4>
<p>and I'm reluctant to continue with the approach "just find every <code>def_id</code> appearing in the list of clauses and call <code>program_clauses_for(def_id)</code>" in <code>program_clauses_for_env</code></p>



<a name="135469158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135469158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135469158">(Oct 09 2018 at 13:26)</a>:</h4>
<p>basically I fear that we would add too much useless clauses and that the computed set would be really big</p>



<a name="135470492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470492">(Oct 09 2018 at 13:46)</a>:</h4>
<p>I think I expected to refine it at some point, yes</p>



<a name="135470511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470511">(Oct 09 2018 at 13:46)</a>:</h4>
<p>I was expecting to even take into account "simplified" types and the like</p>



<a name="135470518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470518">(Oct 09 2018 at 13:47)</a>:</h4>
<p>though of course we could move some of that logic into chalk-engine instead</p>



<a name="135470532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470532">(Oct 09 2018 at 13:47)</a>:</h4>
<p>maybe it makes sense to do some of that sooner rather than later</p>



<a name="135470656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470656">(Oct 09 2018 at 13:48)</a>:</h4>
<p>I think we should at least separate different forms of clauses for now</p>



<a name="135470672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470672">(Oct 09 2018 at 13:48)</a>:</h4>
<p>I propose that we somehow "tag" them</p>



<a name="135470691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470691">(Oct 09 2018 at 13:49)</a>:</h4>
<p>basically there would be three categories, "implied bounds", "well formed" and "other"</p>



<a name="135470725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470725">(Oct 09 2018 at 13:49)</a>:</h4>
<p>we keep the <code>program_clauses_for(...)</code> but we can filter on the tag before passing them to chalk-engine</p>



<a name="135470859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470859">(Oct 09 2018 at 13:51)</a>:</h4>
<p>I see</p>



<a name="135470861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/program-clauses%20callback/near/135470861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/program-clauses.20callback.html#135470861">(Oct 09 2018 at 13:51)</a>:</h4>
<p>that seems good</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>